import java.util.StringTokenizer;

class P10528 {

	public static void main(String[] args) {
//		String[] array = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C"};
//		int[] ints = {2, 2, 1, 2, 2, 2, 1};
//		
//		for (int k = 0; k < array.length; k++) {
//			System.out.print(array[k] + " : { ");
//			int index = k;
//			for (int j = 0; j < ints.length; j++) {
//				System.out.print("\""+array[index] + "\",");
//				index += ints[j];
//				if (index >= array.length) {
//					index -= array.length - 1;
//				}
//			}
//			System.out.println("\"" + array[index] + "\"};");
//		}
		
		
		String line = readLn();
		while (!"END".equals(line)) {
			process(line);
			line = readLn();
		}
	}

	
// C, C#, D, D#, E, F, F#, G, G#, A, A#, B, C
	// tone, tone, semi-tone, tone, tone, tone, semi-tone.
	// C : C, D, E, F, G, A, B, C
	// F : F, G, A, A#, C, D, E, F
	// C#: C#, D#, F, F#
	
	static String[][] notes = { { "C","D","E","F","G","A","B","C"},
					{ "C#","D#","F","F#","G#","A#","C","C#"},
					{ "D","E","F#","G","A","B","C#","D"},
					{ "D#","F","G","G#","A#","C","D","D#"},
					{ "E","F#","G#","A","B","C#","D#","E"},
					{ "F","G","A","A#","C","D","E","F"},
					{ "F#","G#","A#","B","C#","D#","F","F#"},
					{ "G","A","B","C","D","E","F#","G"},
					{ "G#","A#","C","C#","D#","F","G","G#"},
					{ "A","B","C#","D","E","F#","G#","A"},
					{ "A#","C","D","D#","F","G","A","A#"},
					{ "B","C#","D#","E","F#","G#","A#","B"}};

	private static void process(String line) {
		StringTokenizer st = new StringTokenizer(line);
		String[] array = new String[st.countTokens()];
		int length = array.length;
		for (int k = 0; k < length; k++) {
			array[k] = st.nextToken();
		}
		
		String answer = "";
		
		for (int k = 0; k < notes.length; k++) {
			if (allInside(notes[k], array)) {
				answer += " " + notes[k][0];
			}
		}
		
		System.out.println(answer.trim());
		
	}

	private static boolean allInside(String[] strings, String[] array) {
		int length = array.length;
		for (int k = 0; k < length; k++) {
			if (!contains(array[k], strings)) {
				return false;
			}
		}
		return true;
	}

	private static boolean contains(String query, String[] strings) {
		int length = strings.length;
		for (int k = 0; k < length; k++) {
			if (query.equals(strings[k])) {
				return true;
			}
		}
		return false;
	}

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString()).trim();
	}

}
